define(['app','js/utils/echarts'],function (app,echarts) {
    app.controller('messageCtrl', ['$scope', function($scope) {
      var myChart = echarts.init(document.getElementById('canvans'));
      myChart.setOption({
      baseOption:{
        legend: {
          right: 'center',
          bottom: 0,
          orient: 'horizontal',
          data: ['直接访问','邮件营销','联盟广告','视频广告','搜索引擎']
        },
        series : [
          {
            name: '访问来源',
            type: 'pie',
            roseType : 'radius',
            label: {
              normal: {
                show: false
              },
              emphasis: {
                show: true
              }
            },
            lableLine: {
              normal: {
                show: false
              },
              emphasis: {
                show: true
              }
            },
            data:[
              {value:335, name:'直接访问'},
              {value:310, name:'邮件营销'},
              {value:234, name:'联盟广告'},
              {value:135, name:'视频广告'},
              {value:1548, name:'搜索引擎'}
            ],
            itemStyle: {
              emphasis: {
                shadowBlur: 10,
                shadowOffsetX: 0,
                shadowColor: 'rgba(0, 0, 0, 0.5)'
              }
            }
          }
        ],
      },
      media:[
          {
            option: {
              legend: {
                right: 'center',
                bottom: 0,
                orient: 'horizontal'
              },
              series: [
                {
                  type:'pie',
                  center: ['50%', '50%']
                },
              ]
            }
          },
          {
            query: {
              minAspectRatio: 1
            },
            option: {
              legend: {
                right: 'center',
                bottom: 0,
                orient: 'horizontal'
              },
              series: [
                {
                  type:'pie',
                  radius: [20, '50%'],
                  center: ['50%', '50%']
                },
              ]
            }
          },
          {
            query: {
              maxAspectRatio: 1
            },
            option: {
              legend: {
                right: 'center',
                bottom: 0,
                orient: 'horizontal'
              },
              series: [
                {
                  type:'pie',
                  radius: [20, '50%'],
                  center: ['50%', '30%']
                },
              ]
            }
          },
          {
            query: {
              maxWidth: 500
            },
            option: {
              legend: {
                right: 10,
                top: '15%',
                orient: 'vertical'
              },
              series: [
                {
                  type:'pie',
                  radius: [20, '50%'],
                  center: ['50%', '50%']
                },
              ]
            }
          },
        ],
      });
      window.onresize = myChart.resize;
    }]);
});

